const express = require('express');
const router = express.Router();
const experimentController = require('../../controllers/experiment.controller');
const auth = require('../../middlewares/auth');
const role = require('../../config/roles');

// 获取所有实验
router.get(
  '/experiments/',
  auth(role.TEACHER),
  experimentController.getExperiments
);

// 获取单个实验详情
router.get(
  '/experiments/:id',
  auth(role.TEACHER),
  experimentController.getExperimentById
);

// 创建新实验
router.post(
  '/experiments/',
  auth(role.TEACHER),
  experimentController.createExperiment
);

// 更新实验
router.put(
  '/experiments/:id',
  auth(role.TEACHER),
  experimentController.updateExperiment
);

// 删除实验
router.delete(
  '/experiments/:id',
  auth(role.TEACHER),
  experimentController.deleteExperiment
);


module.exports = router;